#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 105;

int n, m;
int a[N][N];
int sum[N][N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) rep(j, 1, n) cin >> a[i][j];
  rep(i, 1, n) rep(j, 1, n) sum[i][j] =
      sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + a[i][j];
  int ans = -1e9;
  rep(r, 1, n) rep(c, 1, n) rep(i, 1, n + 1 - r) rep(j, 1, n + 1 - c) {
    int ni = i + r - 1, nj = j + c - 1;
    int now = sum[ni][nj] - sum[i - 1][nj] - sum[ni][j - 1] + sum[i - 1][j - 1];
    ans = max(ans, now);
  }
  cout << ans;
  return 0;
}